package com.socialvampic.login;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.social.vampic.R;
import com.socialvampic.login.SignInView.OnSignInListener;
import com.socialvampic.login.activity.LoginActivity;
import com.socialvampic.mvc.controller.Controller;

public class SignInController extends Controller implements OnSignInListener {
	private SignInView mView;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		mView = new SignInView(getActivity());

		mView.createView(inflater, null);
		mView.setOnSignInListener(this);
		mView.setLanguageListener(this);

		mLanguage.attach(mView);

		return mView;
	}

	@Override
	public void onDestroy() {
		// TODO Auto-generated method stub
		mView.destroyView();
		mLanguage.detach(mView);

		super.onDestroy();
	}

	@Override
	public void OnCancel() {
		// TODO Auto-generated method stub
		Activity activity = getActivity();
		Intent intent = new Intent(activity, LoginActivity.class);
		startActivity(intent);
		activity.overridePendingTransition(R.anim.in_to_right,
				R.anim.out_to_right);
		activity.finish();
	}

	@Override
	public void OnLogin(String account, String password) {
		// TODO Auto-generated method stub

	}

	@Override
	public void onLanguageChanged() {
		// TODO Auto-generated method stub
		mView.reloadView();
	}

}
